package com.tsd.base;

import com.tsd.core.utils.HlpUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: BaseCodeRuleConstants
 * @Description: TODO
 * @Author: Hillpool
 * @Date: 2022/8/1 11:53
 * @Version: 1.0
 */
public class BaseCodeRuleConstants {
    /**
     * 编码规则中的参数名
     * 客户sid
     * 供应商sid
     * 部门sid
     */
    public static final String RULE_ITEM_PARAM_NAME_CLIENT_SID = "client_sid";
    public static final String RULE_ITEM_PARAM_NAME_SUPPLIER_SID = "supplier_sid";
    public static final String RULE_ITEM_PARAM_NAME_GROUP_SID = "group_sid";
    public static final String RULE_ITEM_PARAM_NAME_RELATED_PARTY_SID = "related_party_sid";

    /**
     * 类型：固定值
     */
    public static final int TYPE_FIX = 1;
    /**
     * 类型：日期格式
     */
    public static final int TYPE_DATE = 2;
    /**
     * 类型：动态文本
     */
    public static final int TYPE_AUTO_TEXT = 3;
    /**
     * 类型：顺序号
     */
    public static final int TYPE_SN = 4;
    /**
     * 日期格式值：年份(YYYY)
     */
    public static final String TYPE_DATE_VALUE1_YYYY = "yyyy";
    /**
     * 日期格式值：短年份(YY)
     */
    public static final String TYPE_DATE_VALUE1_YY = "yy";
    /**
     * 日期格式值：长日期(YYYYMMDD)
     */
    public static final String TYPE_DATE_VALUE1_YYYYMMDD = "yyyyMMdd";
    /**
     * 日期格式值：短日期(YYMMDD)
     */
    public static final String TYPE_DATE_VALUE1_YYMMDD = "yyMMdd";
    /**
     * 日期格式值：长日期时间(YYYYMMDDHHMMSS)
     */
    public static final String TYPE_DATE_VALUE1_YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
    /**
     * 日期格式值：短日期时间(YYMMDDHHMMSS)
     */
    public static final String TYPE_DATE_VALUE1_YYMMDDHHMMSS = "yyMMddHHmmss";
    /**
     * 日期格式值：时间(HHMMSS)
     */
    public static final String TYPE_DATE_VALUE1_HHMMSS = "HHmmss";
    /**
     * 日期格式值：年月份(yyyyMM)
     */
    public static final String TYPE_DATE_VALUE1_YYYYMM = "yyyyMM";
    /**
     * 日期格式值：短年月份(yyMM)
     */
    public static final String TYPE_DATE_VALUE1_YYMM = "yyMM";
    /**
     * 动态文本值：往来单位简称
     */
    public static final String TYPE_AUTO_TEXT_VALUE_1_RELATED_PARTY = "related_party_short_name";
    /**
     * 顺序号-位数类型值：年
     */
    public static final String TYPE_SN_VALUE1_YY = "yy";
    /**
     * 顺序号-位数类型值：月
     */
    public static final String TYPE_SN_VALUE1_YYMM = "yyMM";
    /**
     * 顺序号-位数类型值：日
     */
    public static final String TYPE_SN_VALUE1_YYMMDD = "yyMMdd";
    /**
     * 顺序号-是否往来单位：否
     */
    public static final int TYPE_SN_VALUE3_NO_RELATED_PARTY = 0;
    /**
     * 顺序号-是否往来单位：是
     */
    public static final int TYPE_SN_VALUE3_RELATED_PARTY = 1;

    /**
     * 往来单位
     */
    public static final String TYPE_RELATED_PARTY_CODE = "base_related_party";
    public static final String TYPE_NAME_RELATED_PARTY_CODE = "往来单位";

    private static final Map<String, String> RULE_CODE_NAME_MAP;

    static {
        RULE_CODE_NAME_MAP = new HashMap<>();
        RULE_CODE_NAME_MAP.put(TYPE_RELATED_PARTY_CODE, TYPE_NAME_RELATED_PARTY_CODE);
    }

    public static String getRuleName(String ruleCode) {
        if (!HlpUtils.isEmpty(ruleCode)) {
            return RULE_CODE_NAME_MAP.get(ruleCode);
        }
        return null;
    }
}
